var t = getApp();

Page({
    data: {
        language: "",
        deposit_total: "",
        order_status: "",
        id: ""
    },
    onLoad: function(t) {
        t.id && this.setData({
            id: t.id
        }), this.getData();
    },
    onReady: function() {
        var t = wx.getStorageSync("langIndex");
        this.setData({
            language: t.en
        });
    },
    onShow: function() {},
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {},
    onShareAppMessage: function() {},
    getData: function() {
        var e = this, a = t.getNetAddresss("plugin.lease-toy.api.retreat.return.index");
        a += "&order_id=" + this.data.id, t._getNetWork({
            url: a,
            success: function(t) {
                var a = t.data;
                1 == a.result && e.setData({
                    deposit_total: a.data.deposit_total,
                    order_status: a.data.return_name
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    },
    applyData: function() {
        var e = t.getNetAddresss("plugin.lease-toy.api.retreat.return.leaseApply");
        e += "&order_id=" + this.data.id, t._getNetWork({
            url: e,
            success: function(t) {
                var e = t.data;
                1 == e.result ? wx.showToast({
                    title: "申请成功",
                    icon: "none",
                    duration: 1500,
                    success: function() {
                        setTimeout(function() {
                            wx.navigateBack({
                                delta: 1
                            });
                        }, 1500);
                    }
                }) : wx.showToast({
                    title: e.msg,
                    icon: "none",
                    duration: 1500,
                    success: function() {
                        setTimeout(function() {
                            wx.navigateBack({
                                delta: 1
                            });
                        }, 1500);
                    }
                });
            },
            fail: function(t) {
                console.log(t);
            }
        });
    }
});